<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>vue.extend</title>
    <script type="text/javascript" src="../assets/js/vue-2.3.0.js"></script>
</head>
<body>
    <h1>vue.extend扩展实例构造器</h1>
    <hr>
    <div id="app">
        <my-com></my-com>

    </div>
    <div id="mount-point"></div>
</body>
<script type="text/javascript">

    var Profile = Vue.extend({
            template: '<p>{{firstName}} {{lastName}} aka {{alias}}</p>',
            data: function () {
                return {
                    firstName: 'Walter',
                    lastName: 'White',
                    alias: 'Heisenberg'
                }
            }
        })
    // 创建 Profile 实例，并挂载到一个元素上。
    new Profile().$mount('#mount-point')

    //通过组件创建
    var myCom = Vue.extend({
        template: '<div>这是我的组件</div>'
    })
    Vue.component('my-com',myCom)


    var app = new Vue({
        el:'#app',
        data:{
            message: 'helloworld!'
        }
    })
</script>
</html>